
<!-- 前台页面加载公用的js -->
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<c:set var="ctx" value="${pageContext.request.contextPath}/"/>
<!--[if IE 8]> <head lang="zh-cmn-Hans" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <head lang="zh-cmn-Hans" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<meta charset="utf-8">
<title>UDCMS</title>
<base href="${ctx}">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<link rel="Bookmark" href="${ctx}assets/favicon.ico" >
<link rel="Shortcut Icon" href="${ctx}assets/favicon.ico" />
<link rel="shortcut icon" href="${ctx}assets/favicon.ico" />
<script src="${ctx}assets/js/jquery.min.js"></script>
<!--[if lt IE 9]>
<script type="text/javascript" src="${ctx}assets/plugins/html5.js"></script>
<script type="text/javascript" src="${ctx}assets/plugins/respond.min.js"></script>
<script type="text/javascript" src="${ctx}assets/plugins/PIE/PIE_IE678.js"></script>
<![endif]-->

<!--[if IE 6]>
<script type="text/javascript" src="${ctx}assets/plugins/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
 
<script type="text/javascript">          
	
var basePath = "${ctx}";
var ctx = "${ctx}";
var ctxLess=ctx.substring(0,(ctx.length-1));
var debug = false;
(function(){  
	   if(!window.debugs){  
	    window.debugs = function(message){  
	      try{  
	           if(!window.console){  
	               window.console = {};  
	               window.console.log = function(){  
	                  return;  
	               }  
	           }  
	           console.log(message);  
	      }catch(e){}  
	    }; 
	   }
	}  
)(); 
$(function(){
	//将ctx放在cookie中已便在后来加载的js中获取
	document.cookie="ctxLess="+ctxLess;
});
/**设置全局的ajax配置信息*/
$.ajaxSetup({
	async : false,
	global:false,//布尔值，规定是否为请求触发全局 AJAX 事件处理程序。默认是 true。
	type: "POST",//规定请求的类型（GET 或 POST）。
	timeout: 3000,// 	设置本地的请求超时时间（以毫秒计）。
	headers : {
		'Accept' : 'application/json; charset=UTF-8',
		'Content-Type' : 'application/json; charset=UTF-8'
	},
	dataType : "json", // 	预期的服务器响应的数据类型。
	contentType: "application/json; charset=UTF-8",
	//contentType : 'application/json',//默认是："application/x-www-form-urlencoded"。  application/json;charset=UTF-8
	error:function(xhr){
		alertError("<fmt:message key='sys.errorMessage'/>: " + xhr.status + "<fmt:message key="Check.server.status"/>！" );//请求失败遇到异常触发+ xhr.statusText
	},
	complete: function (xhr, status) { 
		debugs('complete ajax! status:' + status+''); //完成请求后触发。即在success或error触发后触发
	},beforeSend: function (xhr) {
		debugs('beforeSend ajax ...');//发送请求前触发
	}
});

/**当图片加载失败时调用该函数，加载默认图片*/
function loadErrorImage(obj){
	obj.src="${ctx}assets/cms/front/imgs/notImage.png";
	obj.onerror=null;
};

function alertMsg(msg){
	alert(msg);
}
</script>